﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Subfaculty.WebApplication.Translators;
using Subfaculty.Common.Entities;
using Subfaculty.WebApplication.ViewModels;

namespace Test.WebApplication.Translators
{
	[TestClass]
	public class DepartmentTranslatorTest
	{
		private DepartmentTranslator _translator;
		[TestInitialize]
		public void TestInit()
		{
			_translator = new DepartmentTranslator();
		}

		[TestMethod]
		public void ReturnDepartmentViewModelOnTranslateDdepartment()
		{
			var department = new Department
							{
								Id = 3,
								Title = "Электронно вычислительные машины и сети",
								Abbreviation = "ЭВМиС"
							};

			var pe = _translator.Translate(department);

			Assert.AreEqual(department.Id, pe.Id);
			Assert.AreEqual(department.Title, pe.Title);
			Assert.AreEqual(department.Abbreviation, pe.Abbreviation);
		}

		[TestMethod]
		public void ReturnDepartmentOnTranslateBackDdepartmentViewModel()
		{
			var departmentPE = new DepartmentViewModel
			{
				Id = 3,
				Title = "Электронно вычислительные машины и сети",
				Abbreviation = "ЭВМиС"
			};

			var department = new Department();
			_translator.TranslateBack(departmentPE, department);

			Assert.AreEqual(departmentPE.Id, department.Id);
			Assert.AreEqual(departmentPE.Title, department.Title);
			Assert.AreEqual(departmentPE.Abbreviation, department.Abbreviation);
		}
	}
}
